package domain;

import java.util.ArrayList;
import java.util.List;

public class CrossRoad extends TrafficInfrastructure {

	public CrossRoad(float x, float y, String id) {
		super(id);
		this.segment = new Segment(x,y);
		segment.subscribeCarChangeObserver(new Segment.CarChangeObserver() {
			public void notifyCarChange() {
				notifyObservers();
			}
		});
	}
	
	/* *** segment van de crossroad *** */
	public Segment getSegment() {
		return segment;
	}
	
	private Segment segment;

	public boolean hasSegment(Segment seg) {
		return seg == segment;
	}
	
	@Override
	public List<Segment> getSegments() {
		List<Segment> segm = new ArrayList<Segment>();
		segm.add(getSegment());
		return segm;
	}
	
	@Override
	public int getLength() {
		return 1;
	}
}
